home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 34.zip / BS1 part 34 / FredFish PD 307.adf / FileIO / Test.asm < prev    next >
Assembly Source File  |  1990-01-13  |  21KB  |  606 lines

  1.  ;====Uncomment these directives for MANX asm only!!
  2.  ; far   code ;so that we can use register a4, and no limit on program size.
  3.  ; far   data
  4.  
  5.  SMALLOBJ ;CAPE PC relative addressing substituted for absolute
  6.  
  7.  INCLUDE  "rad:FileIO.i"
  8.  
  9.  ;======Amiga Library routines======
  10.    XREF    _LVOCloseLibrary,_LVOCloseScreen,_LVOCloseWindow,_LVOSetMenuStrip
  11.    XREF    _LVOOpenWindow,_LVOOpenScreen,_LVOOpenLibrary
  12.    XREF    _LVOGetMsg,_LVOReplyMsg,_LVOWait,_LVOMove,_LVOText
  13.    XREF    _LVOSetAPen,_LVOSetBPen,_LVOSetDrMd
  14.  
  15.  ;======From the startup code======
  16.    XREF    _SysBase,_DOSBase
  17.  
  18.  ;======From dissidents utilities lib
  19.    XREF up_to_low_case_str,append
  20.  
  21. ; This program opens and utilizes the requester library in order to obtain
  22. ; a full pathname string from the user. When the user clicks the right mouse
  23. ; button, the program calls TestFileIO which calls the library routine that
  24. ; does the entire requester operation. A menu is included in order to enable
  25. ; certain features such as:
  26. ; EXTENSION - Sets the FileIO's EXTENSION_MATCH flag so that only filenames
  27. ;             that end in a specified extension are matched. I have allowed
  28. ;             the user to type in the extension he wishes via the FileIO's
  29. ;             PromptUserEntry function.
  30. ; WORKBENCH - Gives workbench pattern matching (i.e. only .info files are
  31. ;             displayed but without the .info) A file not ending in .info is
  32. ;             ignored.
  33. ; DEVICE    - Uses device names (i.e. DF0:) instead of the disk's real name.
  34. ; CUSTOM    - Inserts a custom handler for the requester's StartUpHandler
  35. ;             which just displays an autorequester message.
  36. ; TYPENAME  - Uses the lib function TypeFilename to completely bypass the
  37. ;             file requester, and uses the titlebar instead.
  38. ; MULTIFILE - Sets the MULTIPLE_FILES bit of the FileIO so that the user can
  39. ;             select several filenames.
  40.  
  41. ; Any or all of these can be set simultaneously, but you should enable one
  42. ; at a time to see the actual effect.
  43. ; If running this program from the CLI and you specify any argument on the
  44. ; command (i.e.  1> TestFileIO blort ), then the window will open on a hires
  45. ; screen. You can then see what the requester looks like in hires.
  46.  
  47. LIB_VERSION equ 33
  48.  
  49. ;  For Manx,   ln -o TestFileIO  ManxStartUp.o  main.o  cl32.lib
  50. ;
  51. ;  For Others, Blink StartUp.o main.o amiga.lib NODEBUG to TestFileIO
  52.  
  53. ExtBufSize equ 21  ;(30-1)-PromptLen
  54.  
  55.    SECTION FileIOTestCode,CODE
  56.  
  57.    XDEF   _main
  58. _main:
  59.     movem.l   d2-d7/a2-a6,-(sp)
  60.     movea.l   _SysBase,a6
  61. ;======Open The Intuition Library=======
  62.     moveq     #LIB_VERSION,d0
  63.     lea       IntuitionName,a1
  64.     jsr       _LVOOpenLibrary(a6)
  65.     lea       _IntuitionBase,a4
  66.     move.l    d0,(a4)+
  67.     beq       C7
  68. ;======Open The Graphics Library========
  69.     moveq     #LIB_VERSION,d0
  70.     lea       GfxName,a1
  71.     jsr       _LVOOpenLibrary(a6)
  72.     move.l    d0,(a4)+
  73.     beq       C6
  74. ;*******Open the "Brand New, Improved, Exciting" Requester library*********
  75.     moveq     #1,d0            ;version 1
  76.     lea       RequesterName,a1
  77.     jsr       _LVOOpenLibrary(a6)
  78.     move.l    d0,(a4)+
  79.     beq       C5
  80. ;=====If started from WBench, then don't open a CUSTOM screen
  81.     movea.l   _IntuitionBase,a6
  82.     move.l    52(sp),d0
  83.     beq.s     .9
  84. ;=====If opened from CLI with any argument, then open CUSTOM screen
  85.     subq.l    #2,48(sp)
  86.     bcs.s     .9
  87.     lea       newScreen,a0
  88.     jsr       _LVOOpenScreen(a6)
  89.     lea       newWindow,a0
  90.    ;-----Window's Screen = ScreenPtr
  91.     move.l    d0,30(a0)
  92.     beq.s     .9A             ;If an error, forget the screen!
  93.    ;-----Window's Type = CUSTOMSCREEN
  94.     move.w    #15,46(a0)
  95. ;=========Open the FileIO window==========
  96. .9  lea       newWindow,a0
  97. .9A jsr       _LVOOpenWindow(a6)
  98.     move.l    d0,(a4)+
  99.     beq       C2
  100.     movea.l   d0,a3
  101.    ;---Get Window's RastPort
  102.     move.l    50(a3),(a4)
  103. ;====Attach our menu to the window======
  104.     lea       ProjectMenu,a1
  105.     movea.l   a3,a0
  106.      ;  _IntuitionBase,a6
  107.     jsr       _LVOSetMenuStrip(a6)
  108. ;-----Get a FileIO structure
  109. E1  movea.l   _RequesterBase,a6
  110.     jsr       _LVOGetFileIO(a6)
  111.     movea.l   d0,a4
  112.     move.l    d0,d1
  113.     beq       IOe          ;If NULL, then error, so exit this test program.
  114. ;---Set Colors and DrawMode
  115.     moveq     #1,d0
  116.     move.b    d0,FILEIO_DRAWMODE(a4)
  117.     movea.l   RastPort,a2
  118.     movea.l   a2,a1
  119.     movea.l   _GfxBase,a6
  120.     jsr       _LVOSetDrMd(a6)
  121.     moveq     #2,d0
  122.     move.b    d0,FILEIO_PENA(a4)
  123.     movea.l   a2,a1
  124.     jsr       _LVOSetAPen(a6)
  125.     moveq     #0,d0
  126.     move.b    d0,FILEIO_PENB(a4)
  127.     movea.l   a2,a1
  128.     jsr       _LVOSetBPen(a6)
  129. ;====Set up custom handlers for the FileIO but don't enable the flag yet===
  130.     move.l    #HandlerBlock,FILEIO_CUSTOM(a4) ;the address of our handler vectors
  131. ;====Set up the XY co-ordinates of where the requester will open====
  132. ; If we used DoFileIOWindow(), we wouldn't need to set co-ordinates.
  133.     moveq     #6,d0
  134.     move.w    d0,FILEIO_X(a4)  ;x position
  135.     moveq     #11,d0
  136.     move.w    d0,FILEIO_Y(a4)  ;y position
  137.  ;---Get the buffer where the complete Path will be stored
  138.     move.l   #buffer,FILEIO_BUFFER(a4)
  139.  ;---Set up EXTENTION in case the user wants to enable it via function key 4
  140.  ;   If we allow this feature, we must supply a buffer of at least 30 bytes
  141.  ;   If we don't want the user to utilize this feature, then FILEIO_EXTENTION
  142.  ;   field must be zeroed and EXTENTION_MATCH flag cleared whenever we
  143.  ;   aren't using this feature.
  144.     lea      ExtMatch,a0
  145.     move.l   a0,FILEIO_EXTENSION(a4)
  146. ;====Create a mask of the Window's UserPort's mp_Sigbit=====
  147. E3  movea.l   86(a3),a0
  148.     move.b    15(a0),d0
  149.     moveq     #0,d7
  150.     Bset.l    d0,d7
  151. ;=====Get the message that arrived at our UserPort====
  152. E4  movea.l   86(a3),a0
  153.     movea.l   _SysBase,a6
  154.     jsr       _LVOGetMsg(a6)
  155.     move.l    d0,d1
  156.     bne.s     E7
  157. ;===Check if we are ready to exit the program=====
  158. E5  Btst.b    #0,Quit
  159.     beq       E15
  160. ;----Print out "Click Mouse to start demo....
  161.     movea.l   RastPort,a2
  162.     moveq     #5,d0
  163.     moveq     #75,d1
  164.     movea.l   a2,a1           ;our window's RastPort
  165.     move.l    a6,-(sp)        ;save _SysBase
  166.     movea.l   _GfxBase,a6
  167.     jsr       _LVOMove(a6)
  168.     moveq     #36,d0          ;# of bytes to output.
  169.     lea       Click,a0
  170.     movea.l   a2,a1
  171.     jsr       _LVOText(a6)
  172.     movea.l   (sp)+,a6        ;restore _SysBase
  173. ;===Wait for a message sent to our Window (from Intuition)===
  174. E6  move.l    d7,d0
  175.     jsr       _LVOWait(a6)
  176.     bra.s     E4
  177. ;====Copy all the info we want from the IntuiMessage====
  178. E7  movea.l   d0,a1
  179.     lea       20(a1),a0  ;get the address of the first field to copy.
  180.     move.l    (a0)+,d6   ;Copy the Class field to d6
  181.     move.w    (a0)+,d5   ;Copy the Code field to d5
  182.     move.w    (a0)+,d4   ;Copy the qualifier field to d4
  183.     movea.l   (a0)+,a2   ;Copy the IAddress field to a2
  184.     move.w    (a0)+,d3   ;Copy MouseX position to d3
  185.     move.w    (a0)+,d2   ;Copy MouseY position to d2
  186. ;====Now reply to the message so Intuition can dispose of it
  187. E8  ;Address of the message is in a1.
  188.     jsr       _LVOReplyMsg(a6)
  189. ;========switch (class)=========
  190.     Bclr.l    #9,d6  ;CLOSEWINDOW
  191.     bne       CW
  192.     Bclr.l    #8,d6  ;MENUPICK
  193.     bne.s     MU
  194.     Bclr.l    #3,d6  ;MOUSEBUTTONS
  195.     beq       E4
  196. ;---Make sure that it's an UP select if MOUSEBUTTONS
  197.     subi.b    #$68,d5
  198.     beq       E4     ;ignore down
  199. ;===The FOLLOWING ROUTINE IS OUR TEST CALL. WHEN THE USER IS DONE (in FileIO lib)
  200. ;===HE WILL SELECT EITHER THE CANCEL OR OK! GADGET. IF CANCEL, TestFileIO
  201. ;===DOES NOTHING. IF OK!, TestFileIO JUSTS PRINTS THE SELECTED FILENAME.
  202. E2  bsr       TestFileIO
  203.   ;If TestFileIO returns a 1, then we should CLEAR the NO_CARE_REDRAW
  204.   ;flag in any FileIOs that had it SET. We aren't using this feature though
  205.   ;because another application might change the disks unbeknowst to us.
  206.   ;NO_CARE_REDRAW is only SET when you don't care if the list of names
  207.   ;displayed is updated to include any recent changes by another task.
  208.   ;We probably should clear it though, just in case the user set it.
  209.     bra     E4
  210. ;=========case MENUPICK:===============
  211. ; Actually, if the user selects some of these flags via the function keys,
  212. ; our menu checkmarks won't accurately reflect the real state of the
  213. ; option. We really should set the menuitem's CHECKED flag depending on the
  214. ; toggled state of the FileIO flag. This is just a simple example though.
  215. ; Normally, you wouldn't need to have menus for these options since in the
  216. ; case of CUSTOM handlers it should be invisible to the user. For things
  217. ; like INFO_SUPPRESS, let the user set it himself with the function keys.
  218.   ;------Determine which item
  219. MU lsr.w   #5,d5         ;Shift the item # bits into lowest bits of reg.
  220.    andi.w  #$3F,d5       ;Isolate the Item # from the Menu and subitem #.
  221.    beq.s   G4            ;branch if Item #0 (Extension)
  222.    subq.w  #1,d5
  223.    beq     G3            ;branch if Item #1 (WB)
  224.    subq.w  #1,d5
  225.    beq     G5            ;branch if Item #2 (Device)
  226.    subq.w  #1,d5
  227.    beq     G1            ;branch if Item #3 (Custom)
  228.    subq.w  #1,d5
  229.    beq     G6            ;branch if Item #4 (No Info)
  230.    subq.w  #1,d5
  231.    beq     AB            ;branch if Item #5 (About)
  232.    subq.w  #1,d5
  233.    beq     I6            ;branch if Item #6 (TypeName)
  234.    subq.w  #1,d5
  235.    bne     E4
  236. ;---Set MULTIPLE_FILES
  237.    bchg.b  #MULTIPLE_FILES,1(a4)
  238.    bra     E4
  239. ;---We deliberately call TypeFilename instead of DoFileIO
  240. I6 bchg.b  #0,Flag
  241.    bra     E4
  242. ;---Display Info about this program
  243. AB movem.l a2/a3,-(sp)
  244.    movea.l a3,a0         ;window
  245.    lea     Msg1,a1
  246.    lea     Msg2,a2
  247.    lea     Msg3,a3
  248.    movea.l _RequesterBase,a6
  249.    jsr     _LVOAutoPrompt3(a6)
  250.    movem.l (sp)+,a2/a3
  251.    bra     E4
  252. G6 Bchg.b  #INFO_SUPPRESS,1(a4)  ;toggle the INFO_SUPPRESS flag ON/OFF
  253.    bra     E4
  254. G1 Bchg.b  #1,(a4)       ;toggle the CUSTOM_HANDLERS flag ON/OFF
  255.    bra     E4
  256. G4 Bchg.b  #EXTENSION_MATCH,1(a4) ;toggle the EXTENSION_MATCH flag ON/OFF
  257.    bne     E4
  258.  ;WARNING: Must have RAWKEY set in order to call PromptUserEntry or UserEntry
  259.  ;---get the user's choice of extention
  260.    lea     ExtPrompt,a0
  261.    moveq   #ExtBufSize,d0
  262.    lea     ExtMatch,a1  ;display the previous extention
  263.    movea.l a4,a2
  264.    ;window in a3
  265.    movea.l _RequesterBase,a6
  266.    jsr     _LVOPromptUserEntry(a6)
  267.  ;---Did he enter anything?
  268.    move.l  d0,d1    ;buffer
  269.    bne     MF
  270.    Bclr.b  #EXTENSION_MATCH,1(a4) ;turn it back off
  271.    bra     E4
  272.  ;---Set the FileIO match string and size of string
  273.  ;---Now we copy buffer to ExtMatch buffer, converting to all lower case
  274.  ;   since the library needs to see the match string in lower case ONLY.
  275. MF movea.l d0,a1
  276.    lea     ExtMatch,a0
  277.    jsr     up_to_low_case_str
  278.    move.w  d0,FILEIO_EXTSIZE(a4) ;size of extension (don't count NULL)
  279.    bra     E4
  280. G3 Bchg.b  #WBENCH_MATCH,1(a4) ;toggle the WBENCH_MATCH
  281.    bra     E4
  282. G5 Bchg.b  #USE_DEVICE_NAMES,1(a4) ;toggle USE_DEVICE_NAMES
  283.    bra     E4
  284. ;=========case CLOSEWINDOW:============
  285. CW  Bclr.b    #0,Quit
  286.     bra       E4
  287. ;======if an error, indicate NO_MEMORY. This is a FileIO routine
  288. ;======and is callable even if GetFileIO() fails
  289. IOe movea.l   a3,a0
  290.     moveq     #0,d0
  291.     movea.l   _RequesterBase,a6
  292.     jsr       _LVOAutoFileMessage(a6)
  293. ;========NOW BEGINS OUR EXIT ROUTINE=========
  294. E15 movea.l   a4,a1                ;If the pointer to FileIO was NULL, then
  295.     movea.l   _RequesterBase,a6    ;ReleaseFileIO just returns, so it's safe to
  296.     jsr       _LVOReleaseFileIO(a6) ;always release any return value of GetFileIO.
  297. ;=====Close the Window and Screen======
  298. C1  movea.l   _IntuitionBase,a6
  299.     movea.l   a3,a0
  300.     jsr       _LVOCloseWindow(a6)
  301. C2  move.l    ScreenPtr,d0
  302.     beq.s     C3            ;check if we specified a screen
  303.     movea.l   d0,a0
  304.     ; _IntuitionBase in a6
  305.     jsr       _LVOCloseScreen(a6)
  306. ;=====Close Whichever Libs are Open (_SysBase in a6 for ALL calls)=====
  307. C3  movea.l  _SysBase,a6
  308.     movea.l  _RequesterBase,a1
  309.     jsr      _LVOCloseLibrary(a6)
  310. C5  movea.l  _GfxBase,a1
  311.     jsr      _LVOCloseLibrary(a6)
  312. C6  movea.l  _IntuitionBase,a1
  313.     jsr      _LVOCloseLibrary(a6)
  314. C7  movem.l  (sp)+,d2-d7/a2-a6
  315.     rts
  316.  
  317. ;*******************************************
  318. ; This just calls the DoFileIO library routine and displays a msg on return.
  319. ; (GetFileIO must have been called with success first).
  320. ; The DoFileIO routine returns -1 if the user selected CANCEL,
  321. ; or returns the address of the Pathname string if OK! was selected. At this
  322. ; point, we could call a load or save operation using this filename string,
  323. ; but instead, we simply display the chosen name.
  324. ;   TestFileIO(FileIO, window)
  325. ;                a4      a3
  326.  
  327. typename:
  328. ;--This shows what would happen (automatically) if the lib was in use on a
  329. ;  call to DoFileIO(), or the requester couldn't open.
  330.    jsr       _LVOTypeFilename(a6)
  331.    bra.s     cex
  332.    XDEF TestFileIO
  333. TestFileIO:
  334.     movea.l  _RequesterBase,a6
  335.  ;-----DoFileIO(FileIO, window, Buffer)
  336.     movea.l  a3,a1
  337.     movea.l  a4,a0
  338.     Btst.b   #0,Flag
  339.     bne.s    typename
  340.     jsr      _LVODoFileIO(a6)
  341. cex move.l   d0,d1
  342.     beq.s    .error 
  343.  ;must have been an error. If we were using DoFileIOWindow(), the window
  344.  ;might not have opened. For DoFileIO(), we shouldn't see a 0 return.
  345.  ;We could check the FileIO's ERRNO field to see what the specific error was.
  346.     addq.l   #1,d1
  347.     beq.s    .can        ;If -1, user must have selected CANCEL
  348.  ;-----AutoMessage(buffer, window) Display our path.
  349.     ;buffer in d0
  350.     movea.l  a3,a0
  351.     jsr      _LVOAutoMessage(a6)
  352. ; Now we could check the FileIO's Filename field to see if the user entered
  353. ; a file, or just a drawer or disk name alone. If not NULL, we have a filename.
  354. ; Next we would check the FILEIO_FILESIZE field. If this is 0, then
  355. ; the user must have typed in a filename that doesn't yet exist. We could
  356. ; create it now. Otherwise, this field tells us how large the selected file is.
  357.     move.b   FILEIO_FILENAME(a4),d0
  358.     beq.s    dirdisk
  359.     move.l   FILEIO_FILESIZE(a4),d0
  360.     bne.s    exists
  361.     move.l   #NoExist,d0
  362.     movea.l  a3,a0
  363.     jsr      _LVOAutoMessage(a6)
  364. ; If MULTIPLE_FILES, display all of the filenames that we selected, one at a
  365. ; time.
  366. exists:
  367.      btst.b   #MULTIPLE_FILES,1(a4)
  368.      beq.s    NoCare
  369.      clr.l    -(sp)      ;zero our PTR to a FileEntry
  370. morFL:
  371.      movea.l  sp,a0
  372.      movea.l  a4,a1
  373.      jsr      _LVORetrieveEntry(a6)
  374.      move.l   d0,d1
  375.      beq.s    last
  376.      movea.l  d0,a0
  377.      move.l   8(a0),d0   ;get the Entry structure
  378.      addq.l   #5,d0      ;get the EntryString address
  379.      movea.l  a3,a0
  380.      jsr      _LVOAutoMessage(a6)
  381.      bra.s    morFL
  382. last addq.l   #4,sp
  383. ; Clear the DISK_HAS_CHANGED flag. If it was SET, we should clear the
  384. ; NO_CARE_REDRAW flag in all of our FileIOs.
  385. ; We only need to bother with this if we had SET the NO_CARE_REFRESH flag
  386. ; (or the user did via function key 6). We aren't using this feature though
  387. ; because another application might change the disks unbeknowst to us.
  388. ; NO_CARE_REDRAW is only SET when you don't care if the list of names
  389. ; displayed is updated to include any recent changes by another task.
  390. NoCare  Bclr.b  #5,(a4)
  391.         bne.s   .32
  392.         Bclr.b  #NO_CARE_REDRAW,1(a4)
  393. .32     rts
  394. .error: move.l  #errmsg,d0
  395. prt     movea.l a3,a0
  396.         jsr     _LVOAutoMessage(a6)
  397.         bra.s   NoCare
  398. .can    move.l  #cancel,d0
  399.         bra.s   prt
  400. dirdisk move.l  #just,d0
  401.         bra.s   prt
  402.  
  403. start_msg: ;a custom handler for requester's REQSET
  404.     movea.l  window,a0
  405.     move.l   #MSG,d0
  406.     move.l   a6,-(sp)        ;must save a6 (non-scratch) here
  407.     movea.l  _RequesterBase,a6
  408.     jsr      _LVOAutoMessage(a6)  ;depending on if the user selects OK or
  409.     movea.l  (sp)+,a6             ;NO, the internal library's startup handler
  410.     rts                           ;will be executed or skipped.
  411.  
  412.   ; SECTION MainData,DATA  ;Not needed for CAPE PC relative addressing!!
  413.  
  414.    XDEF _IntuitionBase,_GfxBase,ScreenPtr
  415.    XDEF _RequesterBase
  416.  ;must be in this order
  417. _IntuitionBase dc.l 0
  418. _GfxBase       dc.l 0
  419. _RequesterBase dc.l 0
  420. window         dc.l 0
  421. RastPort       dc.l 0
  422.  
  423.    XDEF   newScreen
  424. newScreen:
  425.    dc.w   0,0         ;LeftEdge, TopEdge
  426.    dc.w   640,400     ;Width, Height
  427.    dc.w   2           ;Depth
  428.    dc.b   0,1         ;Detail, Block pens
  429.    dc.w   -32764      ;ViewPort Modes HIRES|LACE (must set/clr HIRES as needed)
  430.    dc.w   15          ;CUSTOMSCREEN
  431.    dc.l   TextAttr    ;Font
  432.    dc.l   ScrTitle
  433.    dc.l   0           ;Gadgets
  434.    dc.l   0           ;CustomBitmap
  435.  
  436.    XDEF   newWindow
  437. newWindow:
  438.           dc.w   30,30
  439.           dc.w   298,140
  440.           dc.b   0,1
  441.  ;IDCMP = MOUSEBUTTONS|CLOSEWINDOW|MENUPICK|RAWKEY
  442.  ;Must have RAWKEY set in order to call PromptUserEntry,UserEntry,GetString
  443.           dc.l   $708
  444.  ;WindowFlags = WINDOWDRAG|WINDOWDEPTH|SMART_REFRESH|ACTIVATE|WINDOWCLOSE
  445.  ;(no FOLLOWMOUSE allowed as that messes up the requester when using
  446.  ;DoFileIO(). If you need FOLLOWMOUSE, then use DoFileIOWindow() to open
  447.  ;the req in its own window.)
  448.           dc.l   $100E
  449.           dc.l   0
  450.           dc.l   0
  451.           dc.l   WINTITLE
  452. ScreenPtr dc.l   0
  453.           dc.l   0
  454.           dc.w   298,140
  455.           dc.w   600,240
  456.           dc.w   1         ;WBENCHSCREEN
  457.  
  458. ;==========THE PROJECT MENU===========
  459.  
  460. ProjectMenu:
  461.    dc.l 0
  462.    dc.w 0,0
  463.    dc.w 90,0
  464.    dc.w 1
  465.    dc.l ProjectTitle
  466.    dc.l ExtItem
  467.    dc.w 0,0,0,0
  468.  
  469. ;======The Items in Menu0========
  470.  ;These are MenuItem structures for the preceding Menu Structure.
  471. ExtItem   dc.l WBItem
  472.           dc.w 0,0
  473.           dc.w 200,10
  474.           dc.w $5F
  475.           dc.l 0
  476.           dc.l ExtText
  477.           dc.l 0
  478.           dc.b 'E'
  479.           dc.b 0
  480.           dc.l 0
  481.           dc.w 0
  482. WBItem    dc.l DevItem
  483.           dc.w 0,10,200,10
  484.           dc.w $5F
  485.           dc.l 0,WBText,0
  486.           dc.b 'W'
  487.           dc.b 0
  488.           dc.l 0
  489.           dc.w 0
  490. DevItem   dc.l CusItem
  491.           dc.w 0,20,200,10,$5F
  492.           dc.l 0,DevText,0
  493.           dc.b 'D',0
  494.           dc.l 0
  495.           dc.w 0
  496. CusItem   dc.l InfoItem
  497.           dc.w 0,30,200,10,$5F
  498.           dc.l 0,CusText,0
  499.           dc.b 'C',0
  500.           dc.l 0
  501.           dc.w 0
  502. InfoItem  dc.l AboutItem
  503.           dc.w 0,40,200,10,$5F
  504.           dc.l 0,InfoText,0
  505.           dc.b 'I',0
  506.           dc.l 0
  507.           dc.w 0
  508. AboutItem dc.l TypeItem
  509.           dc.w 0,50,200,10,86
  510.           dc.l 0,AboutText,0
  511.           dc.b 'A',0
  512.           dc.l 0
  513.           dc.w 0
  514. TypeItem  dc.l MultiItem
  515.           dc.w 0,60,200,10,$5F
  516.           dc.l 0,TypeText,0
  517.           dc.b 'T',0
  518.           dc.l 0
  519.           dc.w 0
  520. MultiItem dc.l 0
  521.           dc.w 0,70,200,10,$5F
  522.           dc.l 0,MultiText,0
  523.           dc.b 'M',0
  524.           dc.l 0
  525.           dc.w 0
  526. ExtText   dc.b 0,1,1,0
  527.           dc.w 19,0
  528.           dc.l TextAttr,ExtString,0
  529. WBText    dc.b 0,1,1,0
  530.           dc.w 19,0
  531.           dc.l TextAttr,WBString,0
  532. DevText   dc.b 0,1,1,0
  533.           dc.w 19          ;allow room for the checkmark
  534.           dc.w 0
  535.           dc.l TextAttr,DevString,0
  536. CusText   dc.b 0,1,1,0
  537.           dc.w 19,0
  538.           dc.l TextAttr,CusString,0
  539. InfoText  dc.b 0,1,1,0
  540.           dc.w 19,0
  541.           dc.l TextAttr,NoInfoString,0
  542. AboutText dc.b 0,1,1,0
  543.           dc.w 19,0
  544.           dc.l TextAttr,AboutString,0
  545. TypeText dc.b 0,1,1,0
  546.           dc.w 19,0
  547.           dc.l TextAttr,TypeString,0
  548. MultiText dc.b 0,1,1,0
  549.           dc.w 19,0
  550.           dc.l TextAttr,MultiString,0
  551.  
  552. TextAttr:        ;Topaz 8 is a ROM font so doesn't need to be opened
  553.    dc.l   FONTNAME
  554.    dc.w   8      ;TOPAZ_EIGHTY
  555.    dc.b   0,0
  556.  
  557. HandlerBlock: ;these are the addresses of my custom handlers for the requester's
  558.               ;REQSET, GADGETUP and GADGETDOWN, DISKINSERTED, RAWKEY, and
  559.               ;MOUSEMOVE respectively. Note that I only installed a StartUp
  560.               ;handler. The rest are NULL because I don't care about them.
  561.    dc.l   start_msg     ;StartUpHandler
  562.    dc.l   $0000         ;GadgetHandler
  563.    dc.l   $0000         ;NewDiskHandler
  564.    dc.l   $0000         ;KeyHandler
  565.    dc.l   $0000         ;MouseMoveHandler
  566.  
  567. Quit dc.b 1  ;When this is a 0, the user wants to exit.
  568.  
  569. ScrTitle      dc.b 'Example FileIO Program Screen',0
  570. WINTITLE      dc.b 'Example FileIO Program Window',0
  571. Click         dc.b 'Click mouse for demo or CLOSEWINDOW.',0
  572. IntuitionName dc.b 'intuition.library',0
  573. IconName      dc.b 'icon.library',0
  574. DOSName       dc.b 'dos.library',0
  575. GfxName       dc.b 'graphics.library',0
  576. RequesterName dc.b 'requester.library',0
  577. FONTNAME      dc.b 'topaz.font',0
  578. errmsg        dc.b 'Error in accessing the requester',0
  579. cancel        dc.b 'The CANCEL gadget was selected.',0
  580. ExtString     dc.b 'Extension',0
  581. CusString     dc.b 'Custom',0
  582. WBString      dc.b 'WorkBench',0
  583. DevString     dc.b 'Device',0
  584. NoInfoString  dc.b 'No Info',0
  585. AboutString   dc.b 'About',0
  586. TypeString    dc.b 'Type Name',0
  587. MultiString   dc.b 'Multi File',0
  588. MSG           dc.b 'This is my custom handler',0
  589. ProjectTitle  dc.b 'Project',0
  590. NoExist       dc.b 'This file does not yet exist',0
  591. Msg1   dc.b 'An example of using the FileIO lib',0
  592. Msg2   dc.b 'written by Jeff Glatt',0
  593. Msg3   dc.b '< dissidents >',0
  594. Flag   dc.b 0
  595. just   dc.b 'This is a drawer or disk, not a file.',0
  596.  
  597. PromptLen  equ  7
  598. ExtPrompt  dc.b 'Match >',0
  599.  
  600. buffer    ds.b 202  ;for the complete pathname
  601. ExtMatch  ds.b 30   ;for extension match, must be big enough for extension
  602.                     ;and ExtPrompt because of the way PromptUserEntry works.
  603.  
  604.  
  605.    END
  606.